home *** CD-ROM | disk | FTP | other *** search
- Path: csd.uwo.ca!jamie
- From: jamie@csd.uwo.ca (J. Blustein)
- Newsgroups: comp.edu,comp.lang.c,comp.lang.c++
- Subject: Re: C or C++ for a 14-year old? The definitive reply
- Date: 25 Jan 1996 22:30:03 GMT
- Organization: Computer Science Dept., Univ. of Western Ontario, London, Canada
- Message-ID: <4e909b$k8@falcon.ccs.uwo.ca>
- References: <4cve3a$f0n@news.iconn.net> <4danli$llb@news.onramp.net> <4e3mvdINNpi3@mayne.ugrad.cs.ubc.ca> <4e5t1c$71c@solutions.solon.com>
- Reply-To: jamie@uwo.ca
- NNTP-Posting-Host: gleep.csd.uwo.ca
- Summary: There is no inefficiency in hinding data/code with C. Example below.
- Keywords: opaque type abstract data ADT
- X-Copyright: copyright (c) J. Blustein, 1996. All rights reserved
- X-Url: http://www.csd.uwo.ca/~jamie/.Refs/encapsulatedC.html
- Disclaimer: It's people like you what cause unrest!
-
- In article <4e5t1c$71c@solutions.solon.com>,
- Peter Seebach <seebs@solutions.solon.com> wrote:
- >In article <4e3mvdINNpi3@mayne.ugrad.cs.ubc.ca>,
- >Kazimir Kylheku <c2a192@ugrad.cs.ubc.ca> wrote:
- >>Information hiding leads to inefficiencies---and you _can_ have it in C, by the
- >>way. Even the C preprocessor lets you have efficient information hiding, if you
- >>use it with discipline. It's cheaper to access elements of a function via
- >>macros than be forced to communicate via abstract function calls. The only
- >>advantage that information hiding gives you is that 1) you can change the
- >>implementation of the data structure easily without recompiling modules that
- >>use it (big deal). 2) you have more control over how your software gets used. I
- You don't have to resort to using the pre-processor to hide types and
- function calls. If you use opaque types there is no runtime penalty and
- you get plenty of hiding. Think about how FILE * is hidden in the standard
- library for example.
- I scribbled some notes about this at
- http://www.csd.uwo.ca/~jamie/.Refs/encapsulatedC.html
- . Feel free to take a look.
-
- [...]
- >Point 1 is, in fact, a *very* big deal. The larger the project, the more
- I agree of course.
- --
- Jamie Blustein `Did you say "knives"?'
- <jamie@uwo.ca> `*Rotating* knives, yes.'
-